//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class StringLiteral : DataSource
    {
        private readonly IEnumerable<StringValue> values = new List<StringValue>();

        public StringLiteral()
        {
        }

        public StringLiteral(IEnumerable<StringValue> values)
        {
            this.values = values;
        }
        public StringLiteral (params string []strings)
        {
            var v = new List<StringValue>();
            int i = 0;
            foreach (string s in strings)
            {
                if (s != null)
                    v.Add(new StringValue(i, s));
                i++;
            }
            values = v;
        }

        public IEnumerable<StringValue> StringValues
        {
            get { return values; }
        }

        public override IEnumerable<object> Values
        {
            get { foreach (StringValue o in StringValues) yield return o; }
        }
        [Obsolete]
        internal static StringLiteral NewStringLiteral(int from, int to)
        {
            var l = new List<StringValue>();
            for (int i = from; i <= to; i++)
                l.Add(new StringValue(i - from, i.ToString()));
            return new StringLiteral(l);
        }

        protected override void ReadXmlCore(ReadContext context)
        {
            throw new NotImplementedException();
        }

        protected override void WriteXmlCore(WriteContext context)
        {
            throw new NotImplementedException();
        }
    }
}